# 条件语句(也叫分支语句)
# choice = input("输入数字：")
# if choice == '1':
#     print('yes')
# elif choice == '2':
#     print('No')
# else:
#     print('输入有误')

# # 缩进(Python中缩进是硬性要求)
# a = input("输入第一个数字")
# b = input("输入第二个数字")
# if a == '1':
#     if b == '2':
#         print("aaa")
#     print("bbb")
# print("ccc")
#
# a = int(input('输入一个数字：'))
# if a % 2 == 1:
#     print('奇数') #在Python中负奇数%2结果是1
# else:
#     print('偶数')

# year = int(input('输入一个年份：'))
# if year % 4 == 0:
#     if year % 100 == 0:
#         print('世纪闰年')
#     else:
#         print("闰年")
# else:
#     print("平年")



# # 空语句
# a = input("输入一个数字")
# if a != "1":
#     pass # 空语句pass用来占位，以满足格式需要
# else:
#     print("hello")



# #循环语句
# while循环
# 计算 1! + 2! + ... + n!
# n = int(input())
# Sum = 0
# num = 1
# while num <= n:
#     a = 1
#     i = 1
#     while i <= num: # 循环嵌套
#         a *= i
#         i += 1
#     Sum += a
#     num += 1
# print(f"Sum = {Sum}")

# # for循环
# # range 是一个内建函数，效果是得到一个可迭代对象，range(a,b) -> [a,b)
# for i in range(1, 11, 2): # range的第三个参数叫步长
#     print(i)
# for j in range(10, 0, -1):
#     print(j)
# 求a和b的最大公约数和最小公倍数
# a = int(input())
# b = int(input())
# if a < b:
#     a,b = b,a
# for x in range(b, 0, -1):
#     if a % x == 0 and b % x == 0:
#         print(x)
#         break
# for y in range(a, a * b + 1):
#     if y % a == 0 and y % b == 0:
#         print(y)
#         break
# 找出n以内的所有质数
# n = int(input())
# for i in range (2, n + 1):
#     for j in range(2, i): #for j in range(2, 2) 没有元素，循环体不会执行
#         if i % j == 0:
#             break #中断内部的for循环
#     else: #此处为for - else结构
#         print(i, end=" ")

# continue 和 break
# for i in range(1,6):
#     if i == 3:
#         continue # 中断此次循环，进行下次循环
#     print(i)
# for i in range(1, 6):
#     if i == 3:
#         break # 终止整个循环
#     print(i)
# Sum = 0
# n = 0
# while True:
#     num = input("输入一个数字：")
#     if num == '.':
#         break # 当输入'.'时，结束输入
#     num = float(num)
#     Sum += num
#     n += 1
# print(f"平均值为：{Sum / n}")


